import { Component } from '@angular/core';
import { Stacks } from '../../../../type';
import { ActivatedRoute, Router } from '@angular/router';
import { StockService } from '../../../service/stock.service';
import { StartsComponent } from '../../starts/starts.component';

@Component({
  selector: 'app-stock-from',
  imports: [StartsComponent],
  templateUrl: './stock-from.component.html',
  styleUrl: './stock-from.component.scss'
})
export class StockFromComponent {
   public stock!: Stacks;
   constructor(private routeInfo:ActivatedRoute, private stockService:StockService, private router:Router, ) {

  }
  ngOnInit() {
      const id = this.routeInfo.snapshot.params['id'];
      this.stock = this.stockService.getStack(Number(id));
      console.log(this.stock);
  }
  cancel() {
    this.router.navigateByUrl('/stock')

  }
  save() {
    this.router.navigateByUrl('/stock')

  }



}
